<template>
  <div class="head">
    <div class="head-title">
      我的世界
      <el-button type="primary" @click="changeLanguage">切换语言</el-button>
    </div>
  </div>
</template>
<script>
import { getCurrentInstance } from "vue";
export default {
  name: 'HomeHeadler',
  setup() {
    // 切换语言
    const { proxy } = getCurrentInstance();
    function changeLanguage() {
      let locale_lang = window.localStorage.getItem('locale_lang')
      let chang_lang = locale_lang === 'ch' ? 'en' : 'ch';
      window.localStorage.setItem('locale_lang', chang_lang)
      proxy.$i18n.locale = chang_lang
    }
    return {
      changeLanguage
    }
  }
}
</script>
<style lang="less" scoped>
.head{
  height: 64px;
  background: pink;
  .head-title{
    line-height: 64px;
    font-size: 24px;
  }
}
</style>
